package com.gs.dao.jdbc.impl.test;

import net.sf.json.JSONObject;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.gs.action.datamodel.UserDataModel;
import com.gs.bean.User;
import com.gs.dao.UserDAO;
import com.liang.log.Log;


public class IUserDAOImpltest {
	static ApplicationContext app = new ClassPathXmlApplicationContext("application-*.xml");
	@Test
	public void test(){
		try {
			UserDAO iUserDAO = (UserDAO)app.getBean("iUserDAOImpl");
			User user = new User();
			user.setName("XXeXx");
			user.setPassword("#####");
			//iUserDAO.saveModel(user);
			
			UserDataModel searchModel = new UserDataModel();
			searchModel.setUser(user);
			user = null;
			user = iUserDAO.queryPage(searchModel, 1, 3).getList().get(0);
			
			StringBuffer result = new StringBuffer("{success:true,msg:'添加成功' }");
			JSONObject userJosn = JSONObject.fromObject(user);
			result.insert(result.length() - 2, ",user:"+userJosn.toString());
			Log.info(result.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
